
#include <time.h>
#include <stdio.h>

#include "entity.h"
#include "maxheap.h"

int main(int argc, char** argv)
{
	struct Maxheap *heap = createMaxheap(NULL, -1);
	srand((int)time(0));
	int rands, i = 0;
	char *tmp_name = "hihi";
	
	for(i=0;i<19;i++)
	{
		rands = 10*rand()/10000000+1;
		struct Data data;
		memset((void*)&data, 0, sizeof(data));
		data.num = rands;
		strcpy(data.name, tmp_name);
		
		insert(heap, &data);
		printf("%d\n", rands);
	}

	printf("\n");
	printf("\n");
	
	for(i=0;i<heap->count;i++)
		printf("%s:%d ", heap->array[i].name, heap->array[i].num);

	printf("\n");
	printf("\n");

	struct Data data1;

	removeMax(heap, &data1);

	printf("remove data: %s:%d\n", data1.name, data1.num);

	printf("\n");
	printf("\n");
	
	for(i=0;i<heap->count;i++)
		printf("%s:%d ", heap->array[i].name, heap->array[i].num);
	
	printf("\n");
	printf("\n");
	
	removeMax(heap, &data1);
	printf("remove data: %s:%d\n", data1.name, data1.num);

	for(i=0;i<heap->count;i++)
		printf("%s:%d ", heap->array[i].name, heap->array[i].num);

	printf("\n");
	printf("\n");
	
	delMaxheap(heap);
	return 0;
}
